package com.kcwl.carrier.domain.service;

import com.kcwl.carrier.domain.entity.CarrierForeignDriverCondition;
import com.kcwl.carrier.domain.entity.CarrierForeignDriverDetailInfo;
import com.kcwl.carrier.domain.entity.CarrierForeignDriverInfo;
import com.kcwl.carrier.domain.entity.CarrierForeignDriverListInfo;
import com.kcwl.carrier.domain.repository.IForeignDriverRepository;
import com.kcwl.ddd.domain.entity.KcPage;
import com.kcwl.ddd.infrastructure.utils.KcPageConverter;
import com.kcwl.ddd.interfaces.dto.PageInfoDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@Service
public class ForeignDriverDomainService {

    @Resource
    private IForeignDriverRepository foreignDriverRepository;
    public int addForeignDriver(CarrierForeignDriverInfo carrierForeignDriverInfo) {

        return foreignDriverRepository.insert(carrierForeignDriverInfo);
    }

    public int deleteForeignDriver(Long id) {
        return foreignDriverRepository.delete(id);
    }

    public int disableForeignDriver(Long id) {
        return foreignDriverRepository.updateById(id);
    }
    public int enableForeignDriver(Long id) {
        return foreignDriverRepository.enableForeignDriver(id);
    }
    public KcPage<CarrierForeignDriverListInfo> getForeignDriverList(CarrierForeignDriverCondition carrierForeignDriverCondition) {

        return foreignDriverRepository.getForeignDriverList(carrierForeignDriverCondition);
    }

    public CarrierForeignDriverDetailInfo getForeignDriverDetail(CarrierForeignDriverCondition condition) {
        return foreignDriverRepository.getForeignDriverDetail(condition);
    }

    public int reAddForeignDriver(Long id) {
        return foreignDriverRepository.reAddForeignDriver(id);
    }

    public List<Long> selectDriverIdsByCarrierId(Long userId){
        return foreignDriverRepository.selectDriverIdsByCarrierId(userId);
    }

    public List<Long> selectVehicleIdsByUserId(Long userId){
        return foreignDriverRepository.selectVehicleIdsByUserId(userId);
    }


}
